<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <title>支付订单</title>

    <link rel="stylesheet" href="/shopping/css/style2.css" type="text/css"/>

    <script type="text/javascript" src="/shopping/js/jquery-1.8.2.min.js"></script>
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <script src="/js/common.js"></script>
    <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css">
    <script src="/js/plugins/dialog2/dialog.min.js"></script>

    <script>
        $(function () {
            //获取url上的参数值/订单id
            var param = getParams();
            //获取当前用户的购物车信息
            $.get("/productOrders/"+param.id, function (data) {
                console.log(data);
                $(".payTime").renderValues(data);
                $("#footer").renderValues(data);
            })

            //倒计时
            var timer = document.getElementById("timer");

            var time = 1800;//30分钟换算成1800秒


            setInterval(function () {
                time = time - 1;
                var minute = parseInt(time / 60);
                var second = parseInt(time % 60);
                timer.innerHTML = '还剩' + minute + '分' + second + '秒';


            }, 1000);

            //确认支付按钮绑定提示框,改状态
            $("#pay").click(function () {
                $(document).dialog({
                    content: '已支付成功',
                    onClickConfirmBtn: function () {
                        $.post("/productOrders/updateOrderState",{id:param.id},function (data) {

                            console.log(data);
                            if(data.success){
                                console.log(1);
                                location.href = "/mine/productFinish.html?id="+param.id;
                            }
                        })
                    }
                });
            })
            //返回按钮
            $("#butt").click(function () {
                console.log("1111");
                $(document).dialog({
                    type: 'confirm',
                    closeBtnShow: true,
                    content: '亲,还没支付哦,确定取消吗',
                    onClickConfirmBtn: function () {
                        location.href = "/mine/myOrder.html";
                    },
                })
            })
        })
    </script>

</head>

<body>
<!--头部  star-->
<header style="color:#fff">

    <div class="_left"><img src="images/left.png" id="butt"></div>
    <span>支付订单</span>
</header>
<!--头部 end-->
<!--内容 star-->
<div class="contaniner fixed-cont">
    <div class="pay_img"><img src="images/pay.jpg"></div>

    <div class="payTime">
        <li><span id="timer"></span></li>
        <li>¥<strong render-html="totalPrices"></strong><em>.00</em></li>
        <li render-html="sequence"></li>
    </div>

    <!--支付 star-->
    <div class="pay">
        <div class="show">
            <li><label><img src="images/weixin.png">微信支付<input name="Fruit" type="radio" value="" checked/><span></span></label>
            </li>
            <li><label><img src="images/zhifubao.png">支付宝支付<input name="Fruit" type="radio"
                                                                  value=""/><span></span></label></li>
            <li><label><img src="images/yue.png">余额支付<input name="Fruit" type="radio" value=""/><span></span></label>
            </li>
            <li class="center"><a href="#" onClick="showHideCode()">查看更多支付方式↓</a></li>
        </div>
        <div class="showList" id="showdiv" style="display:none;">
            <li><label><img src="images/yinhang.png">银行卡<input name="Fruit" type="radio" value=""/><span></span></label>
            </li>
            <li><label><img src="images/weixin.png">添加更多<input name="Fruit" type="radio" value=""/><span></span></label>
            </li>

            <li style="background:none"></li>
        </div>
    </div>
    <!--支付 end-->


</div>


<div class="book-recovery-bot2" id="footer">
    <a href="#">
        <div class="payBottom">
            <li class="textfr" id="pay">确认支付:</li>
            <li class="textfl">¥<span render-html="totalPrices"></span>.00</li>
        </div>
    </a>
</div>
<!--内容 end-->


<script type="text/javascript">
    function showHideCode() {
        $("#showdiv").toggle();
    }
</script>

</body>
</html>